﻿@using Century.Web.Security.Authorizations;
@using Century.Web.Security;

@*@model Century.Admin.Models.SiteTreeViewModel*@
@model Century.Admin.Models.SiteTreeViewModel

<link href="@Url.Content("~/Areas/Admin/Content/themes/admin/stylesheet/contextmenu.css")" rel="stylesheet" type="text/css" />

@{
    Layout = null;
}



<input type="hidden" id="selectedContextMenuId" />

@*@(Html.Telerik().TreeView()
        .Name("SiteTreeView")
        .BindTo(Model, (item, site) =>
        {
            item.Text = site.Name + " - " + site.Path;
            item.Value = "CS-" + site.Id.ToString();
            item.LoadOnDemand = true;// site.SitePages == null ? false : site.SitePages.Count > 0;
            item.ImageUrl = "~/Areas/Admin/Content/Themes/Admin/img/sitetree/site_tree.png";
            
        })
        .DragAndDrop(false)
        .ItemAction(z => z.Action("ItemDetail", "SiteTree", new { val = z.Value }))
        .ItemAction(z => z.HtmlAttributes.Add("class", "CS-ITEM"))
        .DataBinding(dataBinding => dataBinding
                .Ajax().Select("GetTreeNodesOnDemand", "SiteTree")
        )
        //.ClientEvents(events => events
        //    .OnExpand("onExpand")

        //)
)*@

@(Html.Telerik().TreeView()
            .Name("TreeView")
            .BindTo(Model.NodeItems)
            .DragAndDrop(false)
            .ItemAction(z => z.Action("ItemDetail", "SiteTree", new { val = z.Value }))
            .ItemAction(z => z.HtmlAttributes.Add("class", z.Value.Contains("CS") ? "CS-ITEM" : z.Value.Contains("P") ? string.Format("SP-ITEM", z.Value) : string.Empty))
            .ExpandAll(true)
)

<script type="text/javascript">
    //function treeView() {
    //    return $('#TreeView').data('tTreeView');
    //}

    //function onExpand(e) {
    //    alert(e.item);
    //}


</script>


